<template>
    <div>
        <el-pagination
            style="text-align: center; padding: 20px 0 10px;"
            layout="total, sizes, prev, pager, next, jumper"
            :current-page="currentPage"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
        />
    </div>
</template>

<script>
export default {
    name: 'Pagination',
    props: {
        currentPage: {
            type: Number,
            required: true
        },
        pageSize: {
            type: Number,
            default: 10
        },
        total: {
            type: Number,
            required: true
        },
        pageSizes: {
            type: Array,
            default: () => [5, 10, 15, 20]
        }
    },
    data() {
        return {
        }
    },
    methods: {
        handleSizeChange(val) {
            this.$emit('handle-size-change', val)
            // console.log(`每页 ${val} 条`)
        },
        handleCurrentChange(val) {
            this.$emit('handle-current-change', val)
            // console.log(`当前页: ${val}`)
        }
    }
}
</script>

<style scoped lang="scss">
    /* div {} */
</style>
